package com.example.demo.infra.repository.impl;

import com.example.demo.app.repository.CourseRepository;
import com.example.demo.domain.entity.Course;
import com.example.demo.infra.mapper.CourseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;


import java.util.List;

@Repository
public class CourseRepositoryImpl implements CourseRepository {
    @Autowired
    private CourseMapper courseMapper;
    @Override
    public Course queryCourseById(Integer id) {
        return courseMapper.selectCourseById(id);
    }

    @Override
    public List<Course> queryCourseList() {
        return courseMapper.selectCourseList();
    }

    @Override
    public Integer addCourse(Course course) {
        return courseMapper.insertCourse(course);
    }

    @Override
    public Integer saveCourse(Course course) {
        return courseMapper.updateCourse(course);
    }

    @Override
    public Integer deleteCourseById(Integer id) {
        return courseMapper.deleteCourseById(id);
    }
}
